#include"bits/stdc++.h"
using namespace std;
int n,a[100],b[100],c[100],j,y,t,z;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i]>>b[i]>>c[i];
		j+=a[i];
		y+=b[i];
		t+=c[i];
	}
	z=j+y+t;
	cout<<j<<" "<<y<<" "<<t<<" "<<z;
}
